package com.zhuifeng.product.service.impl;

import java.util.List;

import com.zhuifeng.common.core.utils.snow.GuuidUtil;
import com.zhuifeng.product.domain.Brand;
import com.zhuifeng.product.mapper.BrandMapper;
import com.zhuifeng.product.service.IBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 品牌Service业务层处理
 *
 * @author zhuifeng
 * @date 2022-08-18
 */
@Service
public class BrandServiceImpl implements IBrandService
{
    @Autowired
    private BrandMapper brandMapper;

    /**
     * 查询品牌
     *
     * @param brandId 品牌主键
     * @return 品牌
     */
    @Override
    public Brand selectBrandByBrandId(String brandId)
    {
        return brandMapper.selectBrandByBrandId(brandId);
    }

    /**
     * 查询品牌列表
     *
     * @param brand 品牌
     * @return 品牌
     */
    @Override
    public List<Brand> selectBrandList(Brand brand)
    {
        return brandMapper.selectBrandList(brand);
    }

    /**
     * 新增品牌
     *
     * @param brand 品牌
     * @return 结果
     */
    @Override
    public int insertBrand(Brand brand)
    {
        brand.setBrandId(GuuidUtil.getUUID()+"");
        return brandMapper.insertBrand(brand);
    }

    /**
     * 修改品牌
     *
     * @param brand 品牌
     * @return 结果
     */
    @Override
    public int updateBrand(Brand brand)
    {
        return brandMapper.updateBrand(brand);
    }

    /**
     * 批量删除品牌
     *
     * @param brandIds 需要删除的品牌主键
     * @return 结果
     */
    @Override
    public int deleteBrandByBrandIds(String[] brandIds)
    {
        return brandMapper.deleteBrandByBrandIds(brandIds);
    }

    /**
     * 删除品牌信息
     *
     * @param brandId 品牌主键
     * @return 结果
     */
    @Override
    public int deleteBrandByBrandId(String brandId)
    {
        return brandMapper.deleteBrandByBrandId(brandId);
    }

    //查询品牌列表
    @Override
    public List<Brand> findAllBrand() {
        return brandMapper.findAllBrand();
    }

    //根据类型查询品牌
    @Override
    public List<Brand> selectBrandByTypeId(String typeId) {
        return brandMapper.selectBrandByTypeId(typeId);
    }

    //状态框
    @Override
    public boolean elSwitch(Brand brand) {
        return brandMapper.elSwitch(brand);
    }
}
